package com.ruoyi.system.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.AppUser;
import com.ruoyi.system.domain.AppUserRelation;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 好友Mapper接口
 * 
 * @author ruoyi
 * @date 2023-02-28
 */
public interface AppUserRelationMapper  extends BaseMapper<AppUserRelation>
{
    /**
     * 查询好友
     * 
     * @param id 好友主键
     * @return 好友
     */
    public AppUserRelation selectAppUserRelationById(Long id);

    /**
     * 查询好友列表
     * 
     * @param appUserRelation 好友
     * @return 好友集合
     */
    public List<AppUserRelation> selectAppUserRelationList(AppUserRelation appUserRelation);

    /**
     * 新增好友
     * 
     * @param appUserRelation 好友
     * @return 结果
     */
    public int insertAppUserRelation(AppUserRelation appUserRelation);

    /**
     * 修改好友
     * 
     * @param appUserRelation 好友
     * @return 结果
     */
    public int updateAppUserRelation(AppUserRelation appUserRelation);

    /**
     * 删除好友
     * 
     * @param id 好友主键
     * @return 结果
     */
    public int deleteAppUserRelationById(Long id);

    /**
     * 批量删除好友
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAppUserRelationByIds(Long[] ids);

    List<Long> getFriendIds(Long userId);

    List<AppUserRelation> selectAppUserIds(AppUserRelation appUserRelation);
    @Select("select friend_id from app_user_relation ${ew.customSqlSegment}")
    List<Long> getFriendIdToTimeLine(@Param("ew") Wrapper<AppUserRelation> relationWrapper);
}
